package Lession1.Puke;

import Lession1.Compare;
import Lession1.Students;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class DouDiZhuGame {
    ArrayList pai =new ArrayList();
    ArrayList kind =new ArrayList();
    /**
     * 将54张扑克牌初始化并放在对应的集合里面
     */
    public void init(){

        kind.add("红桃");
        kind.add("黑桃");
        kind.add("方片");
        kind.add("梅花");
        for (int i=0;i<kind.size();i++){
            String se=(String)kind.get(i);
            for(int j=2;j<11;j++){

                pai.add(new Puke(  j+""   ,se));

            }
            pai.add(new Puke("A",se));
            pai.add(new Puke("J",se));
            pai.add(new Puke("Q",se));
            pai.add(new Puke("K",se));
        }
        pai.add("小王");
        pai.add("大王");
        for(int i=0;i<pai.size();i++){
            System.out.println(pai.get(i));

        }
        System.out.println(pai.size());
    }

    /**
     * 洗牌
     */
    public void xipai(){

        Collections.shuffle(pai);
        System.out.println(pai);


    }

    /**
     * 发牌
     */
    public void send(){
        List newList= pai.subList(0,17);
        System.out.println(newList);
        List newList1= pai.subList(17,34);
        System.out.println(newList1);
        List newList2= pai.subList(34,51);
        System.out.println(newList2);
        List newList3= pai.subList(51,54);
        System.out.println(newList3);

    }

    public static void main(String[] args) {
        DouDiZhuGame douDiZhuGame=new DouDiZhuGame();
        douDiZhuGame.init();
        douDiZhuGame.xipai();
        douDiZhuGame.send();







    }
}
